<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2018/6/21
 * Time: 14:47
 */
namespace app\api\controller\v1;
use think\Controller;
use app\common\model\MenuContent as MenuModel;
class Menucontent extends Base {
    private $model;
    public function _initialize(){
        parent::_initialize();
        $this->model = new MenuModel;
    }
    //获取主菜单信息
    public function getContent(){
        if($this->request->isPost()){
            $pid = intval(trim(input('post.id')));
            if(empty($pid)) return show(400,'id不能为空');
            $res = $this->model->getContent($pid);
            //添加域名
            addDomain($res,'iconurl');
            return show(200,'获取数据成功',$res);
        }
    }

    //获取具体业务信息
    public function getOneContent(){
        if($this->request->isPost()){
            $id = intval(trim(input('post.id')));
            if(empty($id)) return show(400,'id不能为空');

            $res = $this->model->getOneContent($id);
            addOneDomain($res);
            return show(200,'获取数据成功',$res);

        }
    }
}